﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using DAL;
using Common;

public partial class netapp_MasterPage : System.Web.UI.MasterPage
{
    protected string Url1,Url2;
    protected string MenuList1, MenuList2, MenuList3;

    protected void Page_Load(object sender, EventArgs e)
    {

        MenuList1 = "111,112,113,422,431,432,441,442,453";     //客户权限菜单
        MenuList2 = "121,122,131,135,132,133,134,451,452,453";   //调度权限菜单
        MenuList3 = "121,122,131,135,132,133,134,231,232,322,332,331,411,412,451,452,453";  //工程师权限菜单

        //权限判断
        if ( Session["UserType"] == null )
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            int UserType = Convert.ToInt32(Session["UserType"]);
            string MenuType = string.IsNullOrEmpty(Request["MenuType"]) ? "" : Request["MenuType"].ToString().Trim();

            if (MenuType.Length != 3 || MenuType=="")
            {
                WebUtility.JsAlertToBack("传递参数错误");
            }

            switch (UserType)
            {
                case 1:
                    if (MenuList1.IndexOf(MenuType) < 0)
                    {
                        WebUtility.JsAlertToBack("您无权限访问");
                    }
                    break;
                case 2:
                    if (MenuList2.IndexOf(MenuType) < 0)
                    {
                        WebUtility.JsAlertToBack("您无权限访问");
                    }
                    break;
                case 3:
                    if (MenuList3.IndexOf(MenuType) < 0)
                    {
                        WebUtility.JsAlertToBack("您无权限访问");
                    }
                    break;
                default:
                    break;
            }
                
                        
                    
        }
       


        //登陆后初始化页面
        if (Convert.ToInt32(Session["UserType"]) == 1)  //客户
        {
            Url1 = "../Business/Business.aspx?menutype=113";
            Url2 = "../Business/Business_Add.aspx?menutype=111";
        }
        else
        {
            Url1 = "../Business/Business_NotFinish.aspx?menutype=121";
            Url2 = "../Business/Business_Add.aspx?menutype=131";
        }


        

    }

    //退出
    protected void LogOut_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        Response.Redirect("../index.aspx");
    }
}
